package com.bss.dao;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.andy.basics.Constants;
import com.andy.basics.Dao;
import com.bss.model.Country;
import com.bss.model.State;

@Repository
public class StateDao extends Dao<State> {

	private static final String CLASS = StateDao.class.getName();

	private static final Logger DEBUG = Logger.getLogger(Constants.DEBUG_KEY + StateDao.CLASS);

	public List<State> findForCountry(Country country) {

		StateDao.DEBUG.debug("findCountry called for " + country);
		if (country == null) {
			return null;
		}
		return this.find("country.name='" + country.getName() + "'");
	}
}
